<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<link rel="stylesheet" href="http://jqueryui.com/resources/demos/style.css">
<!-- 商务中心排名 -->
<body class="gray-bg">
    
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
							<li>
								交易类型：<select name="tradeType" id = "tradeType">
									<option value="All">所有</option>
									<option value="YK">消费</option>
									<option value="HK">还款</option>
									<option value="WK">快捷收款</option>
									<option value="DK">贷款</option>
									<option value="BK">办卡</option>
									<option value="ZFB">支付宝</option>
									<option value="WXPAY">支付宝</option>
									<option value="JF">积分兑换</option>
								</select>
							</li>
							<li>
								代理等级：<select name="type" id = "type">
									<option value="3">联合创始人</option>
									<option value="2">商务中心</option>
									<option value="1">运营商</option>
								</select>
							</li>
							<li class="select-time">
								<label>查询时间： </label>
								<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
								<span>-</span>
								<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
							</li>
							
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="searchSort()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
	       <!--  <div class="btn-group-sm hidden-xs" id="toolbar" role="group">
				<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:hatchetAgent:add">
					<i class="fa fa-plus"></i> 添加
				</a>
				<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="system:hatchetAgent:edit">
					<i class="fa fa-edit"></i> 修改
				</a>
				<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:hatchetAgent:remove">
					<i class="fa fa-remove"></i> 删除
				</a>
				<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:hatchetAgent:export">
						<i class="fa fa-download"></i> 导出
				 </a>
			</div> -->
			<table id="msg_table">
				<tr >
					<td  style="background-color: yellow;"><strong>数据加载中,请耐心等待......</strong></td>
				</tr>
				<tr></tr>
			</table>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
				<table id="sort_table" border="1" style="width: 80%">
					
				</table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
    $(function() {
   	 init();
   });
   function init(){
	   $("#msg_table").show();
   		$.ajax({
				url : ctx + "system/hatchetAgent/sortAgent", //商务中心排名
				dataType : "json",
				type : "POST",
				data:{
					"type":$("#type").val()
				},
				async : true,
				success : function(re) {
					$("#msg_table").hide();
					var str = "";
					 str += "<tr >";
					 str += "<td align='center'><strong>排名</strong></td>";
					 str += "<td align='center'><strong>商务中心名称</strong></td>";
					 str += "<td align='center'><strong>商务中心编号</strong></td>";
					 str += "<td align='center'><strong>交易流水(元)</strong></td>";
					 str += "</tr>";
					
					$.each(re, function(i,v) {
					str += "<tr>";
					str += "<td  align='center'>"+(i+1)+"</td>";	
					str += "<td  align='center'>"+v.agentName+"</td>";	
					str += "<td  align='center'>"+v.agentNo+"</td>";	
					str += "<td  align='center'>"+v.sumMoney+"</td>";	
					str += "</tr>"
					});
					$("#sort_table").html(str);
				}
			});
   	} 
   
  		 function searchSort(){
  			$("#sort_table").html("");
  			 $("#msg_table").show();
   			$.ajax({
				url : ctx + "system/hatchetAgent/sortAgent", //联创排名
				dataType : "json",
				type : "POST",
				data:{
					"type":$("#type").val(),
					"tradeType":$("#tradeType").val(),
					"beginTime":$("#startTime").val(),
					"endTime":$("#endTime").val()
				},
				async : true,
				success : function(re) {
					$("#msg_table").hide();
					var str = "";
					 str += "<tr >";
					 str += "<td align='center'><strong>排名</strong></td>";
					 str += "<td align='center'><strong>商务中心名称</strong></td>";
					 str += "<td align='center'><strong>商务中心编号</strong></td>";
					 str += "<td align='center'><strong>交易流水(元)</strong></td>";
					 str += "</tr>";
					$.each(re, function(i,v) {
					str += "<tr>";
					str += "<td  align='center'>"+(i+1)+"</td>";	
					str += "<td  align='center'>"+v.agentName+"</td>";	
					str += "<td  align='center'>"+v.agentNo+"</td>";	
					str += "<td  align='center'>"+v.sumMoney+"</td>";	
					str += "</tr>"
					});
					$("#sort_table").html(str);
				}
			});
   	}
  
         
    </script>
    
</body>
</html>